package com.sijibao.gather.consumer.kafka;

public class KafkaConsumerConfig
{
	private String bootstrapServers;
	private String clientId;
	private String topic;
	private String groupId;
	/**
	 * 是否开启自动提交
	 */
	private boolean enableAutoCommit = true;
	/**
	 * 自动提交时间间隔，时间单位：毫秒
	 */
	private int autoCommitIntervalMs = 1000;
	/**
	 * session超时时间，时间单位：毫秒
	 */
	private int sessionTimeoutMs = 30000;

	public KafkaConsumerConfig(String bootstrapServers, String clientId,
			String topic,String groupId)
	{
		super();
		this.bootstrapServers = bootstrapServers;
		this.clientId = clientId;
		this.topic = topic;
		this.groupId=groupId;
	}

	public KafkaConsumerConfig(String bootstrapServers, String clientId,
			String topic,String groupId, boolean enableAutoCommit, int autoCommitIntervalMs,
			int sessionTimeoutMs)
	{
		super();
		this.bootstrapServers = bootstrapServers;
		this.clientId = clientId;
		this.topic = topic;
		this.groupId=groupId;
		this.enableAutoCommit = enableAutoCommit;
		this.autoCommitIntervalMs = autoCommitIntervalMs;
		this.sessionTimeoutMs = sessionTimeoutMs;
	}

	public String getGroupId()
	{
		return groupId;
	}

	public void setGroupId(String groupId)
	{
		this.groupId = groupId;
	}

	public String getTopic()
	{
		return topic;
	}

	public void setTopic(String topic)
	{
		this.topic = topic;
	}

	public String getBootstrapServers()
	{
		return bootstrapServers;
	}

	public void setBootstrapServers(String bootstrapServers)
	{
		this.bootstrapServers = bootstrapServers;
	}

	public String getClientId()
	{
		return clientId;
	}

	public void setClientId(String clientId)
	{
		this.clientId = clientId;
	}

	public boolean isEnableAutoCommit()
	{
		return enableAutoCommit;
	}

	public void setEnableAutoCommit(boolean enableAutoCommit)
	{
		this.enableAutoCommit = enableAutoCommit;
	}

	public int getAutoCommitIntervalMs()
	{
		return autoCommitIntervalMs;
	}

	public void setAutoCommitIntervalMs(int autoCommitIntervalMs)
	{
		this.autoCommitIntervalMs = autoCommitIntervalMs;
	}

	public int getSessionTimeoutMs()
	{
		return sessionTimeoutMs;
	}

	public void setSessionTimeoutMs(int sessionTimeoutMs)
	{
		this.sessionTimeoutMs = sessionTimeoutMs;
	}

	@Override
	public String toString()
	{
		return "KafkaConsumerConfig [bootstrapServers=" + bootstrapServers
				+ ", clientId=" + clientId + ", topic=" + topic + ", groupId="
				+ groupId + ", enableAutoCommit=" + enableAutoCommit
				+ ", autoCommitIntervalMs=" + autoCommitIntervalMs
				+ ", sessionTimeoutMs=" + sessionTimeoutMs + "]";
	}

}
